<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // let str = "12:21,20:30";
        let str = "12:21";
        console.log(/^\d\d:\d\d$/.test(str)); //true
    </script>
</body>

</html>